﻿using RecruitStudents.Client.BLL;
using RecruitStudents.Utility;
using RecruitStudents.Utility.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RecruitStudents.Client.Examinee
{
    public partial class Examinee_EditStudentByOnSign : BaseForm
    {
        ServiceExaminee service = new ServiceExaminee();
        private string strNMT_SignUpID = string.Empty;
        public string strSignUpID = string.Empty;
        public Examinee_EditStudentByOnSign(string _strNMT_SignUpID)
        {
            InitializeComponent();
            txtSG.Focus();
            strNMT_SignUpID = _strNMT_SignUpID;
            DataTable dtStudentsInfo = service.GetExameeByNMT_SignUpID(strNMT_SignUpID);
            if (dtStudentsInfo != null && dtStudentsInfo.Rows.Count >= 1)
            {
                strSignUpID = dtStudentsInfo.Rows[0]["SignUpID"].ToString().Trim();
            }
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtSG.Text == "")
            {
                txtSG.Focus();
                return;
            }
            if (txtTZ.Text == "")
            {
                txtTZ.Focus();
                return;
            }
            if (txtXW.Text == "")
            {
                txtXW.Focus();
                return;
            }
            if (txtYW.Text == "")
            {
                txtYW.Focus();
                return;
            }
            if (txtTW.Text == "")
            {
                txtTW.Focus();
                return;
            }
            if (txtXM.Text == "")
            {
                txtXM.Focus();
                return;
            }
            if (txtSS.Text == "")
            {
                txtSS.Focus();
                return;
            }
            if (txtXS.Text == "")
            {
                txtXS.Focus();
                return;
            }
            //基本信息
            TB_SignUpStudents StudentBaseInfo = service.GetExameeByID(strSignUpID);
            if (StudentBaseInfo != null)
            {
                StudentBaseInfo.Attach();
                StudentBaseInfo.ShoeSize = txtXM.Text.Trim();
                StudentBaseInfo.Hip = txtTW.Text.Trim();
                StudentBaseInfo.Waist = txtYW.Text.Trim();
                StudentBaseInfo.Breast = txtXW.Text.Trim();
                StudentBaseInfo.Weight = txtTZ.Text.Trim();
                StudentBaseInfo.Height = txtSG.Text.Trim();
                StudentBaseInfo.BodyUpper = txtSS.Text.Trim();
                StudentBaseInfo.BodyLower = txtXS.Text.Trim();
                bool flag = service.SaveStudentInfo_Modify(StudentBaseInfo);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
    }
}
